package com.goodmr.passport.log;

import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.sql.Timestamp;

/**
 * 日志数据实体
 *
 * 建议存储到文档型数据库中（如：mongodb）
 *
 * @author <a href="mailto:bingdong13@msn.com">bigo</a>
 */
@Entity
@Table(name = "log")
@Data
class LogEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 帐号ID
     */
    @Column(name = "account_id", length = 20, nullable = false)
    private Long accountId;

    /**
     * 类型
     */
    @Column(length = 3, nullable = false)
    private Integer type;

    /**
     * 设备token
     */
    @Column(name = "device_token", nullable = false)
    private String deviceToken;

    /**
     * 设备标识（Web，Android，iOS）
     */
    @Column(name = "device_name", length = 20, nullable = false)
    private String deviceName;

    /**
     * 渠道标识
     */
    @Column(name = "channel_sign", length = 20, nullable = false)
    private String channelSign;

    /**
     * 客户端版本号
     */
    @Column(name = "client_version", length = 20, nullable = false)
    private String clientVersion;

    /**
     * 客户端IP
     */
    @Column(name = "client_ip", length = 10, nullable = false)
    private Long clientIp;

    /**
     * 创建时间
     */
    @Column(name = "created_at", nullable = false)
    private Timestamp createdAt;
}
